//Source file: D:\\test\\com\\ce\\pms\\custservice\\service\\impl\\SubmitTaskImpl.java
/**
 * 功能描述: 部门协作功能处理类
 * <p>版权所有：中企动力
 * <p>未经本公司许可，不得以任何方式复制或使用本程序任何部分
 *
 * @author  胡煦
 * Create on:2008-12-16
 * Edit author:
 * Edit on:
 * 修改原因：

 */
package com.ce.pms.custservice.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.util.Assert;

import com.ce.pms.base.service.impl.PmsBaseServiceImpl;
import com.ce.pms.base.vo.SearchVO;
import com.ce.pms.common.dao.IOrganizationalStructureDao;
import com.ce.pms.common.model.HmDeptDomain;
import com.ce.pms.common.model.SysrefcodeDO;
import com.ce.pms.custservice.dao.ICustServiceEventDao;
import com.ce.pms.custservice.dao.ISubmitTaskDao;
import com.ce.pms.custservice.model.CustServiceEventDO;
import com.ce.pms.custservice.model.SubmitTaskDO;
import com.ce.pms.custservice.service.IEventManageService;
import com.ce.pms.custservice.service.ISubmitTaskService;
import com.ce.pms.custservice.vo.SubmitTaskSearchVO;
import com.ce.pms.custservice.vo.SubmitTaskVO;
import com.ce.pms.exception.BusinessException;
import com.ce.util.BeanUtil;
import com.ce.util.BlankUtil;
import com.sitechasia.webx.core.support.Page;
import com.sitechasia.webx.core.utils.base.PopulateUtil;
/**
 * 功能描述: 部门协作Service功能类
 * <p>版权所有：中企动力
 * <p>未经本公司许可，不得以任何方式复制或使用本程序任何部分
 *
 * @author  胡煦
 * Create on:2008-12-23
 * Edit author:
 * Edit on:
 * 修改原因：

 */

public class SubmitTaskServiceImpl extends PmsBaseServiceImpl implements
		ISubmitTaskService {
	private ICustServiceEventDao custServiceEventDao;
	/**
	 * @roseuid 49436CB20232
	 */
	public SubmitTaskServiceImpl() {

	}

	public void setCustServiceEventDao(ICustServiceEventDao custServiceEventDao)
	{
		this.custServiceEventDao = custServiceEventDao;
	}

	/**
	 * 方法描述: 任务提交方法（可以多次）
	 * @author 胡煦
	 * Create on:2008-12-16
	 * @param csEventID，tasks
	 * @return List<Object[]>
	 * Edit author:
	 * Edit on:
	 * @param csEventID
	 * @param tasks
	 * @return SubmitTaskVO
	 * @roseuid 49436CB20251
	 * 修改原因：
	 */
	public List<Object[]> addTask(Long csEventID,SubmitTaskVO tasks) {

		this.checkParameterIsNull(csEventID,"custservice:custservice_parameter_null_exception");
		if(BlankUtil.isBlank(tasks)){
			return null;
		}
		Map<Long, List<String>> map = tasks.getPrincipalMap();
		List<Object[]> submitTaskObjlist = null;
		if(map.size() > 0){
			submitTaskObjlist = new ArrayList<Object[]>();
			for(Long deptId : map.keySet()){
				List<String> list = map.get(deptId);
				StringBuilder deptPrincipalName = new StringBuilder("");
				if(list.size()>0){
					// 拼装部门负责人名字
					for(String str : list)
					{
						deptPrincipalName.append(str).append(",");
					}
					deptPrincipalName = deptPrincipalName.deleteCharAt(deptPrincipalName.length()-1);
				}
				Object[] objects = new Object[]{csEventID,deptId,deptPrincipalName.toString(),tasks.getCreator()};
				submitTaskObjlist.add(objects);
			}
			submitTaskDao.batchInsertSubmitTasks(submitTaskObjlist);
		}
		//通知事件已经提交
		eventManageService.noteSubmitTask(csEventID);
		return submitTaskObjlist;
	}
	/**
	 * 方法描述: 任务完工方法
	 * @author 胡煦
	 * Create on:2008-12-22
	 * @param submitTask
	 * @return SubmitTaskVO
	 * Edit author:
	 * Edit on:
	 * @param submitTask
	 * @roseuid 49436CB20290
	 */
	public SubmitTaskVO deptReply(SubmitTaskVO submitTask) {
		if(BlankUtil.isBlank(submitTask)){
			return null;
		}
		SubmitTaskDO submitTaskDO = checkDeptReplyIsTrue(submitTask.getKeyword());
		submitTaskDO.setStatuzHasReplay();
		submitTaskDO.setRemark(submitTask.getRemark());
		if(!BlankUtil.isBlank(submitTask.getModifier())){
			modifyInfo(submitTaskDO.getSysInfo(), submitTask.getModifier());
		}
		submitTaskDao.updateObject(submitTaskDO);
		return submitTask;
	}

	/**
	 * 方法描述: 催单方法
	 * @author 胡煦
	 * Create on:2008-12-22
	 * @param submitTaskID
	 * @return void
	 * @roseuid 49436CB2029F
	 */
	public void hasten(Long submitTaskID) {
		this.checkParameterIsNull(submitTaskID,"custservice:custservice_parameter_null_exception");
		SubmitTaskDO submitTaskDO = this.checkHastenIsTrue(submitTaskID);
		submitTaskDO.increaseFrequency();
	}

	/**
	 * 方法描述: 通知派工单处理中方法
	 * @author 胡煦
	 * Create on:2008-12-22
	 * @param submitTaskID
	 * @return void
	 * @roseuid 49436CB202BF
	 */
	public void noteDeptProcessing(Long submitTaskID) {
		this.checkParameterIsNull(submitTaskID,"custservice:custservice_parameter_null_exception");
		SubmitTaskDO submitTaskDO = submitTaskDao.findById(submitTaskID);
		submitTaskDO.setStatuzProcessing();
	}

	/**
	 * 方法描述: 撤销任务方法
	 * @author 胡煦
	 * Create on:2008-12-22
	 * @param submitTaskVO
	 * @return void
	 * @roseuid 49436CB202CE
	 */
	public void cancelTask(SubmitTaskVO submitTaskVO) {

		if(!BlankUtil.isBlank(submitTaskVO)){
			//只能撤回"待处理"和"处理中"的任务
			SubmitTaskDO submitTaskDO = checkCancelTaskIsTrue(submitTaskVO.getKeyword());
			submitTaskDO.setValidityFalse();
			submitTaskDO.setRemark(submitTaskVO.getRemark());
			if(!BlankUtil.isBlank(submitTaskVO.getModifier())){
				modifyInfo(submitTaskDO.getSysInfo(), submitTaskVO.getModifier());
			}
			//通知事件管理此任务已经撤销
			eventManageService.cancelSubmitTask(submitTaskVO.getKeyword(),submitTaskVO.getCustServiceEventId());
		}
	}
	/**
	 * 方法描述: 催单操作合法性校验方法
	 * @author 胡煦
	 * Create on:2008-12-24
	 * @param submitTaskID
	 * @return SubmitTaskDO
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public SubmitTaskDO checkHastenIsTrue(Long submitTaskID){
		this.checkParameterIsNull(submitTaskID,"custservice:custservice_parameter_null_exception");
		SubmitTaskDO submitTaskDO = submitTaskDao.findById(submitTaskID);
		//"完工"和"已撤回"即"无效"的任务不可以执行该操作
		if(SubmitTaskDO.TASK_COMPLETE_REPLY_CODE.equals( submitTaskDO.getStatuz())||
				SubmitTaskDO.TASK_ACCEPTED_HANDLE_CODE.equals(submitTaskDO.getStatuz())||
				SubmitTaskDO.TASK_VALIDITY_INVALID_CODE.equals(submitTaskDO.getValidity())){
			throw new BusinessException("custservice:custservice_task_hasten_exception", BusinessException.WARNING);
		}
		return submitTaskDO;
	}
	/**
	 * 方法描述: 任务撤销合法性校验方法
	 * @author 胡煦
	 * Create on:2008-12-24
	 * @param submitTaskID
	 * @return SubmitTaskDO
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public SubmitTaskDO checkCancelTaskIsTrue(Long submitTaskID){
		this.checkParameterIsNull(submitTaskID,"custservice:custservice_parameter_null_exception");
		SubmitTaskDO submitTaskDO = submitTaskDao.findById(submitTaskID);
		//只能撤回"待处理"以及"有效"的任务
		if(SubmitTaskDO.TASK_COMPLETE_REPLY_CODE.equals( submitTaskDO.getStatuz())
				||SubmitTaskDO.TASK_ACCEPTED_HANDLE_CODE.equals( submitTaskDO.getStatuz())
				||SubmitTaskDO.TASK_VALIDITY_INVALID_CODE.equals(submitTaskDO.getValidity())){
			throw new BusinessException("custservice:custservice_task_cancel_exception", BusinessException.WARNING);
		}
		return submitTaskDO;
	}
	/**
	 * 方法描述: 任务修改合法性校验方法
	 * @author 胡煦
	 * Create on:2008-12-24
	 * @param submitTaskID
	 * @return SubmitTaskDO
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public SubmitTaskDO checkEditTaskIsTrue(Long submitTaskID){
		this.checkParameterIsNull(submitTaskID,"custservice:custservice_parameter_null_exception");
		SubmitTaskDO submitTaskDO = submitTaskDao.findById(submitTaskID);
		//"完工"和"已撤回"即"无效"的任务不可以执行该操作
		if(SubmitTaskDO.TASK_COMPLETE_REPLY_CODE.equals( submitTaskDO.getStatuz())||
				SubmitTaskDO.TASK_VALIDITY_INVALID_CODE.equals(submitTaskDO.getValidity())){
			throw new BusinessException("custservice:custservice_task_edit_exception", BusinessException.WARNING);
		}
		return submitTaskDO;
	}
	/**
	 * 方法描述: 任务修改方法
	 * @author 胡煦
	 * Create on:2008-12-22
	 * @param submitTask
	 * @return SubmitTaskVO
	 * @param submitTask
	 * @roseuid 49436CB202FD
	 */
	public SubmitTaskVO editSubmitTask(SubmitTaskVO submitTask) {
		if(BlankUtil.isBlank(submitTask)){
			return null;
		}
		SubmitTaskDO submitTaskDO = checkEditTaskIsTrue(submitTask.getKeyword());
		if(!BlankUtil.isBlank(submitTask.getModifier())){
			modifyInfo(submitTaskDO.getSysInfo(), submitTask.getModifier());
		}
		if(!BlankUtil.isBlank(submitTask.getDealViews())){
			submitTaskDO.setDealViews(submitTask.getDealViews());
		}
		if(!BlankUtil.isBlank(submitTask.getReplyViews())){
			submitTaskDO.setReplyViews(submitTask.getReplyViews());
		}
		if(!BlankUtil.isBlank(submitTask.getRemark())){
			submitTaskDO.setRemark(submitTask.getRemark());
		}
		submitTaskDO.setStatuzProcessing();
		submitTaskDO = submitTaskDao.saveObject(submitTaskDO);
		return submitTask;
	}
	/**
	 * 方法描述: 任务完工合法性校验方法
	 * @author 胡煦
	 * Create on:2008-12-24
	 * @param submitTaskID
	 * @return SubmitTaskDO
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public SubmitTaskDO checkDeptReplyIsTrue(Long submitTaskID){
		this.checkParameterIsNull(submitTaskID,"custservice:custservice_parameter_null_exception");
		SubmitTaskDO submitTaskDO = submitTaskDao.findById(submitTaskID);
		//"完工"和"已撤回"即"无效"的任务不可以执行"任务完工"
		if(SubmitTaskDO.TASK_COMPLETE_REPLY_CODE.equals( submitTaskDO.getStatuz())||
				SubmitTaskDO.TASK_VALIDITY_INVALID_CODE.equals(submitTaskDO.getValidity())){
			throw new BusinessException("custservice:custservice_task_deptReply_exception", BusinessException.WARNING);
		}
		return submitTaskDO;
	}
	/**
	 * 方法描述: 任务单次自动提交方法
	 * @author 胡煦
	 *  Create on:2008-12-22
	 * @param csEventID
	 * @param submitTaskVO
	 * @return SubmitTaskVO
	 * @roseuid 49436CB2034B
	 */
	public SubmitTaskVO autoAddTask(Long csEventID, SubmitTaskVO submitTaskVO) {
		this.checkParameterIsNull(csEventID,"custservice:custservice_parameter_null_exception");
		if(BlankUtil.isBlank(submitTaskVO)){
			return null;
		}
		SubmitTaskDO submitTaskDO = this.assembleV2D(submitTaskVO, null);
		submitTaskDO.setSubmitType(SubmitTaskDO.TASK_VALIDITY_INVALID_CODE);
		submitTaskDO.setStatuzProcessing();
		submitTaskDO = submitTaskDao.saveObject(submitTaskDO);
		submitTaskVO.setKeyword(submitTaskDO.getKeyword());
		//通知事件已经提交
		eventManageService.noteSubmitTask(submitTaskVO.getCustServiceEventId());
		return submitTaskVO;
	}
	/**
	 * 方法描述: 根据id获取SubmitTaskVO
	 * @author 胡煦
	 * Create on:2008-12-22
	 * @param id
	 * @return SubmitTaskVO
	 * @roseuid 49436CB20399
	 */
	public SubmitTaskVO getSubmitTaskVOById(Long id) {
		this.checkParameterIsNull(id,"custservice:custservice_parameter_null_exception");
		return this.assembleD2V(submitTaskDao.findById(id), null);
	}

	/**
	 * 方法描述: 获取SubmitTaskVO列表
	 * @author 胡煦
	 * Create on:2008-12-22
	 * @param searchVO
	 * @return List<SubmitTaskVO>
	 * @roseuid 49436CB203B9
	 */
	public List<SubmitTaskVO> querySubmitTaskList(SearchVO searchVO) {
		if(BlankUtil.isBlank(searchVO)){
			return null;
		}
		List<SubmitTaskDO> submitTaskDOList = submitTaskDao.findAll();
		List<SubmitTaskVO> submitTaskVOList = new ArrayList<SubmitTaskVO>();
		if(!BlankUtil.isBlank(submitTaskDOList)){
			for(SubmitTaskDO submitTaskDO : submitTaskDOList){
				submitTaskVOList.add(this.assembleD2V(submitTaskDO, null));
			}
		}
		return submitTaskVOList;
	}

	/**
	 * 功能描述:  <br>
	 * @param taskId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2009-1-4  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public SubmitTaskDO getSubmitTaskDOById(Long taskId){
		return this.submitTaskDao.findById(taskId);
	}

	/**
	 * 方法描述: 分页获取SubmitTaskVO列表
	 * @author 胡煦
	 * @param SubmitTaskSearchVO
	 * @return Page
	 * @roseuid 49436CB3001F
	 */
	public Page querySubmitTaskByPage(SubmitTaskSearchVO searchVO) {
		if(BlankUtil.isBlank(searchVO)){
			return null;
		}
		Page page = submitTaskDao.queryAllSubmitTaskDOByPage(searchVO);
		List<SubmitTaskDO> submitTaskDOList = page.getResult();
		List<SubmitTaskVO> submitTaskVOList = new ArrayList<SubmitTaskVO>();
		if(!BlankUtil.isBlank(submitTaskDOList)){
			for(SubmitTaskDO submitTaskDO : submitTaskDOList){
				submitTaskVOList.add(this.assembleD2V(submitTaskDO, null));
			}
		}
		page.setResult(submitTaskVOList);
		return page;
	}
	/**
	 * 方法描述: 作废派工单下的任务
	 * @author 胡煦
	 * Create on:2008-12-22
	 * @param taskId
	 * @return void
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public void cancelTaskForDispatch(Long taskId) {
		this.checkParameterIsNull(taskId,"custservice:custservice_parameter_null_exception");
		SubmitTaskDO submitTaskDO = submitTaskDao.findById(taskId);
		submitTaskDO.setValidityFalse();
		submitTaskDao.updateObject(submitTaskDO);
		//通知事件管理此任务已经撤销
		eventManageService.cancelSubmitTask(taskId,submitTaskDO.getCustServiceEventDO().getKeyword());
	}
	/**
	 * 方法描述: 通知派工单已经完工方法
	 * @author 胡煦
	 * Create on:2008-12-22
	 * @param taskId
	 * @return void
	 * Edit author:
	 * Edit on:
	 * 修改原因：
	 */
	public void noteDispatchFormComplete(Long taskId) {
		this.checkParameterIsNull(taskId,"custservice:custservice_parameter_null_exception");
		SubmitTaskDO submitTaskDO = submitTaskDao.findById(taskId);
		submitTaskDO.setStatuzHasReplay();
		submitTaskDao.updateObject(submitTaskDO);
	}
	/**
	 * 方法描述: SubmitTaskVO To SubmitTaskDO
	 * @author 胡煦
	 * Create on:2008-12-16
	 * @param taskVO，taskDO
	 * @param taskVO
	 * @param taskDO
	 * @return SubmitTaskDO
	 * @roseuid 4933A6E900EA
	 */
	private SubmitTaskDO assembleV2D(SubmitTaskVO taskVO, SubmitTaskDO taskDO) {
		if(BlankUtil.isBlank(taskVO)){
			return null;
		}
		if(BlankUtil.isBlank(taskDO)){
			taskDO = new SubmitTaskDO();
		}
		BeanUtil.convertVoAsDo(taskVO, taskDO);
		taskDO.setCustServiceEventDO(custServiceEventDao.findById(taskVO.getCustServiceEventId()));
		taskDO.setDeptPrincipal(taskVO.getDeptPrincipalName());
		taskDO.setDeptDO(organizationalStructureDao.queryDeptDoById(taskVO.getDeptId()));
		//taskDO.setDeptFeedback(taskVO.getRemark());
		if(!BlankUtil.isBlank(taskVO.getCreator())){
			taskDO.setSysInfo(createInfo(taskVO.getCreator()));
		}
		return taskDO ;
	}

	/**
	 * 方法描述: SubmitTaskVO To SubmitTaskDO
	 * @author 胡煦
	 * Create on:2008-12-16
	 * @param taskDO
	 * @param taskVO
	 * @return SubmitTaskVO
	 * @roseuid 4933A6FB03D8
	 */
	private SubmitTaskVO assembleD2V(SubmitTaskDO taskDO, SubmitTaskVO taskVO) {
		if(BlankUtil.isBlank(taskDO)){
			return null;
		}
		if(BlankUtil.isBlank(taskVO)){
			taskVO = new SubmitTaskVO();
		}
		PopulateUtil.populate(taskDO, taskVO);
		taskVO.setCreator(taskDO.getSysInfo().getCreator());
		if(null!=taskDO.getSysInfo().getModifyDate()){
			taskVO.setModifyDate(taskDO.getSysInfo().getModifyDate());
		}
		SysrefcodeDO sysrefcodeDO = sysrefcodeDao.getSysrefCodesByCode(SysrefcodeDO.DISPATCH_EVENT_STATUZ_CODE, taskVO.getStatuz());
		taskVO.setStatuName(sysrefcodeDO==null?null:sysrefcodeDO.getName());
		CustServiceEventDO custSerEventDO = taskDO.getCustServiceEventDO();
		if(!BlankUtil.isBlank(custSerEventDO)){
			taskVO.setHouseNumber(taskDO.getCustServiceEventDO().getHouseNumber());
			taskVO.setFullAddress(taskDO.getCustServiceEventDO().getFullAddress());
			taskVO.setCustServiceEventId(custSerEventDO.getKeyword());
			taskVO.setEventNo(custSerEventDO.getEventNo());
			taskVO.setCustServEventNatureName(custSerEventDO.getCustomerServiceEventNatureDO() ==null?null:custSerEventDO.getCustomerServiceEventNatureDO().getName());
			taskVO.setEmergencyDegreeName(custSerEventDO.getEmergencyDegreeDO() ==null?null:custSerEventDO.getEmergencyDegreeDO().getName());
			taskVO.setEventContent(custSerEventDO.getEventContent());
		}
		taskVO.setDeptName(taskDO.getDeptDO().getDeptName());
		taskVO.setDeptId(taskDO.getDeptDO().getDeptId());
		taskVO.setDeptPrincipalName(taskDO.getDeptPrincipal());

		taskVO.setDeptPrincipalId(taskDO.getSysInfo().getCreator());
		return taskVO;
	}
	private ISubmitTaskDao submitTaskDao;
	private IEventManageService eventManageService;
	private IOrganizationalStructureDao organizationalStructureDao ;

	/**
	 * @param submitTaskDao the submitTaskDao to set
	 */
	public void setSubmitTaskDao(ISubmitTaskDao submitTaskDao) {
		this.submitTaskDao = submitTaskDao;
	}

	/**
	 * @param eventManageService the eventManageService to set
	 */
	public void setEventManageService(IEventManageService eventManageService) {
		this.eventManageService = eventManageService;
	}

	public Map<Long, String> checkDepartmentsEventSubmitingNotAllow(SubmitTaskVO submitTaskVO)
	{
		Assert.notNull(submitTaskVO);
		Assert.notNull(submitTaskVO.getCustServiceEventId());
		Assert.notNull(submitTaskVO.getPrincipalMap());
		Assert.notEmpty(submitTaskVO.getPrincipalMap());
		Long eventID = submitTaskVO.getCustServiceEventId();
		//待检验的部门<id>
		Set<Long> departments = submitTaskVO.getPrincipalMap().keySet();
		//没有撤回该事件所对应任务的部门
		List<HmDeptDomain> deptList = submitTaskDao.queryDepartmentsWithValidSubmitTask(eventID);
		if(deptList==null || deptList.isEmpty())
		{
			return null;
		}
		Map<Long, String> departmentsNotPass = new HashMap<Long, String>();
		for(Long deptId : departments)
		{
			//如果部门在查询列表中
			HmDeptDomain deptDo = searchMatchHmDeptDomain(deptId, deptList);
			if(deptDo!=null && !departmentsNotPass.containsKey(deptDo.getDeptId()))
			{
			   departmentsNotPass.put(deptDo.getDeptId(), deptDo.getDeptName());
			}
		}
		return departmentsNotPass.isEmpty() ? null : departmentsNotPass;
	}

	/**
	 * 功能描述: 查找与给定ID所匹配的部门 <br>
	 * @param idToSearch
	 * @param deptList
	 * @return
	 * Create author: 王浩羽 <br>
	 * Create on:Jan 14, 2009  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private HmDeptDomain searchMatchHmDeptDomain(Long idToSearch, List<HmDeptDomain> deptList){
		Assert.notNull(idToSearch);
		if(deptList==null || deptList.isEmpty())
		{
			return null;
		}
		for(HmDeptDomain hmDeptDomain : deptList)
		{

			if(idToSearch.compareTo(hmDeptDomain.getDeptId())==0)
			{
				return hmDeptDomain;
			}
		}
		return null;
	}


	public void checkEventIsAllowSubmit(SubmitTaskVO submitTaskVO){

		Assert.notNull(submitTaskVO);
		Long eventID = submitTaskVO.getCustServiceEventId();
		CustServiceEventDO eventDO = custServiceEventDao.findById(eventID);
		if(eventDO==null)
		{
			throw new BusinessException("custservice:custServiceNotExistsException",BusinessException.WARNING);
		}
		StringBuilder cannotSumbitStatus = new StringBuilder();
		// "完工/待归档/归档/作废"状态的事件不可以提交
		cannotSumbitStatus.append(CustServiceEventDO.EVENT_STATUS_COMPLETE_CODE).append(";");
		cannotSumbitStatus.append(CustServiceEventDO.EVENT_STATUS_ARCHIVING_CODE).append(";");
		cannotSumbitStatus.append(CustServiceEventDO.EVENT_STATUS_ARCHIVED_CODE).append(";");
		cannotSumbitStatus.append(CustServiceEventDO.EVENT_STATUS_CANCEL_CODE).append(";");
		//如果状态不在禁止提交之列，那么就创建任务
		if(cannotSumbitStatus.indexOf(eventDO.getEventStatuz())>-1)
		{
			throw new BusinessException("custservice:custService_not_allow_submitEvent_exception",BusinessException.WARNING);
		}
	}

	public Map<Long,String> createEventTask(SubmitTaskVO submitTaskVO)
	{
		this.checkEventIsAllowSubmit(submitTaskVO);
		Map<Long,String> map = this.checkDepartmentsEventSubmitingNotAllow(submitTaskVO);
		Long eventID = submitTaskVO.getCustServiceEventId();
		//如果状态不在禁止提交之列，那么就创建任务，剩下的判断由SubmitTaskService完成
		addTask(eventID, submitTaskVO);
		return map;
	}

	/**
	 * @param organizationalStructureDao the organizationalStructureDao to set
	 */
	public void setOrganizationalStructureDao(
			IOrganizationalStructureDao organizationalStructureDao) {
		this.organizationalStructureDao = organizationalStructureDao;
	}
}
